﻿using DAO;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Thefaceless
{
    
    class DrinksDAO
    {
        public int DrinksWitdh = 100;
        public int DrinksHeight = 100;
        public DrinksDAO() { }
        //lấy dữ liệu drinks và list
        public List<Drinks> LoadDrinksList()
        {
            List<Drinks> drinksList = new List<Drinks>();
            DataProvider dp = new DataProvider();
            string sql = "select * from DANHMUCDOUONG";
            DataTable dt = dp.ExecuteQuery(sql);
            foreach (DataRow item in dt.Rows)
            {
                Drinks drinks = new Drinks(item);
                drinksList.Add(drinks);
            }

            return drinksList;
        }

        public List<Drinks> LoadDrinksList(String values)
        {
            List<Drinks> drinksList = new List<Drinks>();
            DataProvider dp = new DataProvider();
            string sql = "select * from DANHMUCDOUONG where TenDoUong Like'"+values+"%'";
            DataTable dt = dp.ExecuteQuery(sql);
            foreach (DataRow item in dt.Rows)
            {
                Drinks drinks = new Drinks(item);
                drinksList.Add(drinks);
            }

            return drinksList;
        }
    }
}
